Discover the eight tie-breaking criteria that Algolia uses to rank your results.
Criterion | Behavior | Helpful when |
---|---|---|
Typo | Returns results for queries that match all words in a record including those that contain a few typos. However, exact matches of the query terms rank higher | Some small user errors are likely |
Exact | Returns results for queries that match all words in a record. The more closely the query sequence matches a record, the higher it will rank | Users are likely to type the query correctly, such as the name of a well-known product or company |
Words | Returns results for queries that match some words in a record. | Misinterpretation of user input is more common such as in a voice-to-text search |
aroundPrecision
parameter sets the precision of this ranking.
optionalWords
setting. If you’re not using optionalWords
, this criterion will have the same value for each result.
By default, Algolia only matches results that contain all the query’s words. With optionalWords
, you can declare some words as optional.
The Words criterion ranks them by the number of matching words typed by users (not the number of times the word appears in the record).
For example, if a user typed two words, the maximum score for this criterion is 2 - even if a record contains this word 10 times.
actor_name
attribute: George Clooney
and George Timothy Clooney
. If a user searches for “george clooney”, George Clooney
has a better proximity distance (the two query words are 1 word apart) compared to George Timothy Clooney
(the two query words are 2 words apart).
searchableAttributes
: attributes at the top of the searchableAttributes
list rank higher than lower ones.
The order of matches within the attribute itself is also important.
By default, records with matched words closer to the beginning of a given attribute rank higher.
featured
) rank records set to true
higher than those set to false
.number_of_likes
) rank records based on this number: from the most to the least liked.profession
and full-name
, and the following two records:
objectID
1 has the query words side-by-side in the full-name attributeobjectID
3 has the query words in different attributes.profession
and full-name
). Consequently, with the query “jerry singer”, the term “singer” appears in profession
before full-name
.